<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="app">
        <cpn></cpn>
    </div>

    <template id="CPN">
        <div>
            <h2>我是你爹：：{{title}}</h2>
            <p>我是内容</p>
        </div>
    </template>



    <script>
        //创建组件构造器
        Vue.component('cpn', ({
            template: '#CPN',
            data() {
                return {
                    title: '这是组件内部的data'
                }
            }
        }))

        const vm = new Vue({
            el: '#app',
            data: {
                message: '我是你爹!'
            },
            methods: {}
        });
    </script>
</body>

</html>